#include "QueryPlanNode.h"

DistinctNode::DistinctNode(int inPipeId, int outPipeId, Schema* schema, Pipe *inPipe, Pipe *outPipe) : QueryPlanNode(distinct),
		inPipeId(inPipeId), outPipeId(outPipeId), schema(schema), inPipe(inPipe), outPipe(outPipe) {
}

void DistinctNode::Print(){
	cout<<"********\n";
	cout<<"Distinct\n";
	cout<<"Input pipe ID "<<inPipeId<<endl;
	cout<<"Output pipe ID "<<outPipeId<<endl;
	cout<<"Distinct Attributes:\n";
	schema->Print();
	cout<<"********\n";
}

void DistinctNode::Execute(){
	dr.Use_n_Pages(RUN_LENGTH);
	dr.Run(*inPipe, *outPipe, *schema);
}

void DistinctNode::Wait(){
	dr.WaitUntilDone();
}

void DistinctNode::Clean(){

}
